package com.example.interviewrecorder.utils

import android.app.Activity
import android.os.Process

object LyyActivityCollector {
    private val activities=ArrayList<Activity>()

    fun addAct(activity: Activity){
        activities.add(activity)
    }

    fun removeAct(activity: Activity){
        activities.remove(activity)
    }

    fun finishAll(){
        for (item in activities){
            if(!item.isFinishing){
                item.finish()
            }
        }
        activities.clear()
        Process.killProcess(Process.myPid())
    }

    //获取当前的Activity
    fun getCurrActivity():Activity{
        return activities.last()
    }
}